<?php
/**
 * RepertoireController
 * 
 * @author
 * @version 
 */
require_once 'Zend/Controller/Action.php';
class RepertoireController extends Zend_Controller_Action
{
    public function init()
    {
        parent::init();
		$models = $this->_request->getParam('module').'/models';
		set_include_path('../application/modules/'.$models . PATH_SEPARATOR . get_include_path());
		
		$this->view->module = $this->getRequest()->getModuleName();
		// recupere le module
		$this->view->controller = $this->getRequest()->getControllerName(); 
		// recupere le controller
		$this->view->action = $this->getRequest()->getActionName(); 
		// recupere l'action	
    }
    
    public function indexAction ()
    {
    	
       $this->view->title = "Repertoire des pilotes";
       
       //listage des lettres des pilotes
       $pilote = new Default_Models_DbTable_Pilote();
       $this->view->lettrePilote = $pilote->listPiloteByLettre();
       
       //listage des pilotes par lettre
       $lettre = $this->_getParam('lettre');
       $this->view->lettre = $lettre;
       $this->view->lettrePilote2 = $pilote->searchPiloteByLettre($lettre);
       
       //On affiche les informations pilote
       $id = $this->_getParam('id');
       $this->view->id = $id;
       		//Les infos principales
       		$this->view->infosPrincipales = $pilote->searchPiloteById($id);
       		
       		//les sponsors
       		$this->view->sponsors = $pilote->searchSponsorsPiloteById($id);
			
       		//les images
       		$this->view->images = $pilote->searchImagesPiloteById($id);
    }
}
